import com.chenshu.controller.SController;
import com.chenshu.controller.UserController;
import com.chenshu.model.User;
import com.chenshu.repository.UserRepository;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2023-12-11
 * Time：18:29
 */
public class App {
    public static void main(String[] args) {
        ApplicationContext context =
                new ClassPathXmlApplicationContext("spring-config.xml");

//        UserRepository userRepository =
//                context.getBean("userRepository", UserRepository.class);
//        userRepository. doRepository();
//
//        SController sController =
//                context.getBean("SController", SController.class);
//        sController.doController();
//
//        User user =
//                context.getBean("student1", User.class);
//        System.out.println("Id: " +  user.getId() + " Name: " + user.getName());
//        SController sController = context.getBean("SController", SController.class);
//        sController.doController();

        UserController userController =
                context.getBean("userController", UserController.class);
        userController.doController();
    }
}
